package com.charlie.meetingmanagement.config;

import com.charlie.meetingmanagement.interceptors.LoginInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        部分接口不能拦截
        registry.addInterceptor(loginInterceptor).excludePathPatterns("/adminLogin","/user/getByUsername","/user/register")
                .excludePathPatterns("/api-docs","/api-docs.yaml","/swagger-ui/**","/swagger-ui/index.html")
                .excludePathPatterns("/v3/api-docs");
    }
}
